package base.utils

import android.content.Context
import android.net.ConnectivityManager

/**
 * @author njmsir
 * Created by njmsir on 2017/9/21.
 */
class NetWorkUtils {
    companion object {
        fun isNetWorkAvailable(context: Context): Boolean {
            //得到网络连接信息
            val manager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
            //进行判断网络是否连接
            if (manager.activeNetworkInfo != null) {
                return manager.activeNetworkInfo!!.isAvailable
            }
            return false
        }
    }
}